#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int pivotIndex(int* nums, int numsSize) {
    int mid = 0;
    int i = 0;
    int j = 0;
    int sum1 = 0;
    int sum2 = 0;
    do
    {
        sum1 = 0;
        sum2 = 0;
        for (i = 0; i < mid; i++)
        {
            sum1 += nums[i];
        }
        for (j = mid + 1; j < numsSize; j++)
        {
            sum2 += nums[j];
        }
        if (sum1 != sum2)
            mid += 1;
        else
        {
            return mid;
        }
    } while (sum1 != sum2 && mid < numsSize);
    return -1;
}

int main()
{
    int nums[] = { 1, 7, 3, 6, 5, 6 };
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    int ret = pivotIndex(nums, numsSize);
    printf("%d\n", ret);
    return 0;
}